/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package panaderialabaguette.splash;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JLabel;
/**
 *
 * @author oscar
 */
public class HiloImprimir extends Thread {
    JLabel eti;
    SplashImprimir splash;

    public HiloImprimir(JLabel eti,SplashImprimir splash) {
        this.eti = eti;
        this.splash = splash;
    }

    public void run(){
        for (int i=1; i<=30; i++)
        {
            eti.setIcon(new javax.swing.ImageIcon(ClassLoader.getSystemResource("imagenes/busy/busy-icon"+i+".png")));
            this.pausa(100);
        }
        for (int i=1; i<=30; i++)
        {
            eti.setIcon(new javax.swing.ImageIcon(ClassLoader.getSystemResource("imagenes/busy/busy-icon"+i+".png")));
            this.pausa(100);
        }
        this.splash.setVisible(false);

    }

    public void pausa(int mlSeg){
        try {
            Thread.sleep(mlSeg/2);
        } catch (InterruptedException ex) {
            Logger.getLogger(HiloImprimir.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
